# Maintainer: Diego Sogari <diego.sogari@gmail.com>

_realname=winsparkle
pkgbase="mingw-w64-${_realname}"
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
replaces=("${MINGW_PACKAGE_PREFIX}-${_realname}-git")
conflicts=("${MINGW_PACKAGE_PREFIX}-${_realname}-git")
pkgver=0.5.2
pkgrel=1
pkgdesc='App update framework for Windows, inspired by Sparkle for OS X (mingw-w64)'
arch=('any')
url='http://winsparkle.org'
license=('MIT')
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc")
depends=("${MINGW_PACKAGE_PREFIX}-expat" "${MINGW_PACKAGE_PREFIX}-wxWidgets") # gcc-libs not needed?
source=("${_realname}-${pkgver}.tar.gz::https://codeload.github.com/vslavik/winsparkle/tar.gz/v${pkgver}"
        001-compile-fixes.patch
        Makefile)
sha256sums=('0ee227ae343d1bc3da170a31d9fce0d4053af84538303f1a61fa2d566124112d'
            '9c3b6c798cc47b6225beb55b72164ead1bcd81c39fb899b7261d5b9320f9747e'
            'c92047c7b4ed2829583f967b279d8d771e268f5cf204cf7c4808681132bc5786')

consolidate() {
  cp ../Makefile src
}

prepare() {
  cd "${srcdir}/${_realname}-${pkgver}"
  consolidate
  patch -p1 < "${srcdir}"/001-compile-fixes.patch
}

build() {
  cd "${srcdir}/${_realname}-${pkgver}/src"
  make
}

package() {
  cd "${srcdir}/${_realname}-${pkgver}"
  install -D -m644 include/winsparkle.h         "${pkgdir}${MINGW_PREFIX}/include/winsparkle.h"
  install -D -m644 include/winsparkle-version.h "${pkgdir}${MINGW_PREFIX}/include/winsparkle-version.h"
  install -D -m644 src/libwinsparkle.a          "${pkgdir}${MINGW_PREFIX}/lib/libwinsparkle.a"
  install -D -m644 src/libwinsparkle.dll.a      "${pkgdir}${MINGW_PREFIX}/lib/libwinsparkle.dll.a"
  install -D -m755 src/libwinsparkle.dll        "${pkgdir}${MINGW_PREFIX}/bin/libwinsparkle.dll"
  install -D -m644 COPYING                      "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING"
}
